package cn.masterj.springcloud.controller;

/**
 * @author masterJ
 * @create 2020-04-18 13:06
 */

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author masterJ
 * @create 2020-04-18 12:47
 * 在服务器上更改配置文件，就可以不依赖其他组件，nacos就可以实现自动实时更新配置
 */
@RestController
@RequestMapping("/config")
@RefreshScope
public class ConfigController {


    @Value("${useLocalCache:false}")
    private boolean useLocalCache;


    @Value("${config.info}")
    private String config;


    @RequestMapping("/get")
    public boolean get() {
        return useLocalCache;
    }

    @RequestMapping("/getConfig")
    public String getConfig() {
        return config;
    }


}